const sqlite3 = require('../server/node_modules/sqlite3').verbose();
const path = require('path');

// 创建数据库连接
const dbPath = path.join(__dirname, '../resources/db/db.database');
console.log('Database path:', dbPath);

const db = new sqlite3.Database(dbPath);

// 查询courses和lessons表的数据
db.serialize(() => {
  console.log('\n=== Courses Table Data ===');
  db.all("SELECT * FROM courses", (err, rows) => {
    if (err) {
      console.error('Error:', err);
    } else {
      console.log('Courses:', rows);
    }
  });
  
  console.log('\n=== Lessons Table Data ===');
  db.all("SELECT * FROM lessons", (err, rows) => {
    if (err) {
      console.error('Error:', err);
    } else {
      console.log('Lessons:', rows);
    }
    
    db.close();
  });
});